import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import {
  param
} from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';


// 国际学术会议申请列表
function getApproveList(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getApproveList`,
    method: 'Post',
    data
  });
}
// 国际学术会议查询
function getApproveListBySchool(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getApproveListBySchool`,
    method: 'Post',
    data
  });
}

// 申请国际学术会议 -- 通过
function approveAgree(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/approveAgree`,
    method: 'Post',
    data
  });
}

// 申请国际学术会议 -- 未通过 驳回
function approveRefuse(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/approveRefuse`,
    method: 'Post',
    data
  });
}

// 报销 --  驳回
function conApproveRefuse(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConferenceReimburse/approveRefuse`,
    method: 'Post',
    data
  });
}

// 报销 -- 通过
function conApproveAgree(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConferenceReimburse/approveAgree`,
    method: 'Post',
    data
  });
}


// 导出1
function exportConference(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/exportConference`,
    method: 'Post',
    data
  });
}

// 导出2
function exportConferenceT(data) {
  return fetch({
    url: `${baseUrl}/export/result/` + data,
    method: 'get',
    data
  });
}

// 导出3
function exportExcelT(data) {
  return fetch({
    url: `${baseUrl}/export/file/?path=` + data,
    method: 'get',
    data,
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '国际会议审核列表.xls', 'application/vnd.ms-excel;charset=utf-8');

  });
}

// 高级导出
function advanceExport(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/advanceExport`,
    method: 'Post',
    data
  });
}

// 批量下载附件1
function batchExport(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/batchExport`,
    method: 'Post',
    data
  });
}

// 批量下载附件3
function exportZip(data) {
  return fetch({
    url: `${baseUrl}/export/exportZip/?path=` + data,
    method: 'get',
    data,
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '国际学术会议附件.zip', 'application/zip;charset=utf-8');
  });
}

// 获取用户权限
function recommendRole() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/recommendRole`,
    method: 'get'

  });
}

// 批量下载附件1
function getFilePath(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getFilePath`,
    method: 'Post',
    data
  });
}

// 回国报销导出
function downExcel(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/downExcel`,
    method: 'Post',
    data
  });
}

// 回国报销导出下载
function downloadFile(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/downloadFile?path=`+data,
    method: 'get',
    data
  });
}




export default {
  'getApproveList': getApproveList,
  'getApproveListBySchool': getApproveListBySchool,
  'approveAgree': approveAgree,
  'approveRefuse': approveRefuse,
  'conApproveRefuse': conApproveRefuse,
  'conApproveAgree': conApproveAgree,
  'exportConference': exportConference,
  'exportConferenceT': exportConferenceT,
  'exportExcelT': exportExcelT,
  'advanceExport': advanceExport,
  'batchExport': batchExport,
  'exportZip': exportZip,
  'recommendRole': recommendRole,
  'getFilePath': getFilePath,
  'downExcel': downExcel,
  'downloadFile': downloadFile


};
